package justbuy.order.model;

import java.io.Serializable;
import java.math.BigDecimal;

/*
 * 订单项
 */
public class OrderItem implements Serializable {

	private static final long serialVersionUID = -5603601574402741053L;

	private int quantity;

	private BigDecimal price;

	private String itemId;

	private String itemName;

	public String getItemId() {
		return itemId;
	}

	public void setItemId(String itemId) {
		this.itemId = itemId;
	}

	public String getItemName() {
		return itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		if (quantity > 0)
			this.quantity = quantity;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		if (price != null && price.doubleValue() >= 0)
			this.price = price;
	}

	public BigDecimal getSubtotal() {
		return price.multiply(new BigDecimal(quantity));
	}

}
